#ifndef TOKENSINPUT_H
#define TOKENSINPUT_H

#include <QtGui/QSplitter>
#include <QtGui/QStandardItemModel>
#include <QtGui/QTableView>
#include <QtGui/QPushButton>
#include "gelement.h"
#include "variantinput.h"
#include "tokensmodel.h"

class TokensInput : public QSplitter
{
	Q_OBJECT

public:
	TokensInput( GElement* const element, QWidget *parent = 0);
	~TokensInput();

	void refresh();

private slots:
	void editToken(const QModelIndex & index);
	void moveUp();
	void moveDown();
	void addToken();
	void deleteToken();
	void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight );

	void commitValue();

	void addTrace();
	void deleteTrace();
	void commitTrace();

private:
	void setupUi();
	void setTrace(Token *token);
	
	//Type QMetaType 1--17
	TokensModel mTokenModel;
	QTableView *mTokenView;

	VariantInput *mValueWidget;
	
	QStandardItemModel mTraceModel;
	QTableView *mTraceView;

	QPushButton *tokenUp;
	QPushButton *tokenDown;
	QPushButton *tokenAdd;
	QPushButton *tokenDel;

	QPushButton *traceAdd;
	QPushButton *traceDel;
	QPushButton *traceCommit;
};

#endif // TOKENSINPUT_H
